﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WT.Sockert.Interfaces;

namespace WT.ParkingShare {
    public partial class ClientControl : UserControl {

        private ISocketConnection _Socket;

        public ClientControl(ISocketConnection socket):this(socket, new List < string >()) {
            

        }

        public ClientControl(ISocketConnection socket, List<string> clientToRequest) {
            InitializeComponent();
            _Socket = socket;
            labId.Text = socket.Name;
        }

        

        private void butSend_Click(object sender, EventArgs e) {

        }

        private void btnDetail_Click(object sender, EventArgs e) {

        }

        public delegate void SetContentDelegate(string content);

        public void SetId(string content) {
            if (labId.InvokeRequired) {
                SetContentDelegate setAction = new SetContentDelegate(SetId);
                labId.Invoke(setAction, content);
            } else {
                labId.Text = content;
            }
        }
        public void SetContent(string content) {
            if (labLastContent.InvokeRequired) {
                SetContentDelegate setAction = new SetContentDelegate(SetId);
                labLastContent.Invoke(setAction, content);
            } else {
                labLastContent.Text = content;
            }
        }

    }
}
